Compression assist instructions

ABSTRACT

In an embodiment, a processor supports one or more compression assist instructions which may be employed in compression software to improve the performance of the processor when performing compression/decompression. That is, the compression/decompression task may be performed more rapidly and consume less power when the compression assist instructions are employed then when they are not. In some cases, the cost of a more effective, more complex compression algorithm may be reduced to the cost of a less effective, less complex compression algorithm.

BACKGROUND Technical Field

Embodiments described herein are related to processors and, moreparticularly, to compression assist instructions in processors toimprove compression/decompression performance and power efficiency.

Description of the Related Art

Compression is used for a variety of reasons in computing devices. Forexample, software downloads may be compressed for delivery over anetwork, and may be decompressed on the target computing device forinstallation. In some cases, such as portable computing devices (e.g.smart phones, portable digital assistants, tablet computers, etc.), thesoftware may be decompressed, installed, then recompressed for storageon the device. Storing various software in compressed form may savestorage space on the device, which may be more limited than the storagein larger computing devices such as laptops, desktops, servers, etc.

Compression/decompression is primarily implemented in software, and thusthe cost in performance (and power consumption, on portable devices withlimited power supplies such as batteries) can be significant. Theeffectiveness of a compression algorithm is generally measured in termsof the ratio of the size of the uncompressed original to the size of thecompressed result, referred to as the compression ratio. Unfortunately,the effectiveness of a given compression algorithm is generallycorrelated to its complexity, and thus the cost of effectiveness isperformance (e.g. latency) and power.

SUMMARY

In an embodiment, a processor supports one or more compression assistinstructions which may be employed in compression software to improvethe performance of the processor when performingcompression/decompression. That is, the compression/decompression taskmay be performed more rapidly and consume less power when thecompression assist instructions are employed then when they are not. Insome cases, the cost of a more effective, more complex compressionalgorithm may be reduced to the cost of a less effective, less complexcompression algorithm.

BRIEF DESCRIPTION OF THE DRAWINGS

The following detailed description makes reference to the accompanyingdrawings, which are now briefly described.

FIG. 1 is a block diagram of one embodiment of decompression based on aFinite State Entropy (FSE) compression algorithm.

FIG. 2 is a block diagram of one embodiment of optimization ofdecompression based on the FSE algorithm in which multiple interleavedFSE symbol streams share the same decoder and bit stream.

FIG. 3 is a block diagram of another embodiment of optimization ofdecompression based on the FSE algorithm in which multiple interleavedFSE symbol and value streams share the same decoder table.

FIG. 4 is a block diagram illustrating one embodiment of a bit stackread operation.

FIG. 5 is a block diagram illustrating one embodiment of a bit stackwrite operation.

FIG. 6 is a block diagram illustrating register inputs and outputs forone embodiment of a top decompression assist instruction.

FIG. 7 is a block diagram illustrating register inputs and outputs forone embodiment of a pop decompression assist instruction.

FIG. 8 is a block diagram illustrating register inputs and outputs forone embodiment of a create compression assist instruction.

FIG. 9 is a block diagram illustrating register inputs and outputs forone embodiment of a concat compression assist instruction.

FIG. 10 is a block diagram of one embodiment of a system including aprocessor.

FIG. 11 is a block diagram of one embodiment of a vector execution unitshown in FIG. 10.

FIG. 12 is a flowchart illustrating operation of one embodiment of theprocessor to execute a top instruction.

FIG. 13 is a flowchart illustrating operation of one embodiment of theprocessor to execute a pop instruction.

FIG. 14 is a flowchart illustrating operation of one embodiment of theprocessor to execute a create instruction.

FIG. 15 is a flowchart illustrating operation of one embodiment of theprocessor to execute a concat instruction.

While embodiments described in this disclosure may be susceptible tovarious modifications and alternative forms, specific embodimentsthereof are shown by way of example in the drawings and will herein bedescribed in detail. It should be understood, however, that the drawingsand detailed description thereto are not intended to limit theembodiments to the particular form disclosed, but on the contrary, theintention is to cover all modifications, equivalents and alternativesfalling within the spirit and scope of the appended claims. The headingsused herein are for organizational purposes only and are not meant to beused to limit the scope of the description. As used throughout thisapplication, the word “may” is used in a permissive sense (i.e., meaninghaving the potential to), rather than the mandatory sense (i.e., meaningmust). Similarly, the words “include”, “including”, and “includes” mean“including, but not limited to.” As used herein, the terms “first,”“second,” etc. are used as labels for nouns that they precede, and donot imply any type of ordering (e.g., spatial, temporal, logical, etc.)unless specifically stated.

Within this disclosure, different entities (which may variously bereferred to as “units,” “circuits,” other components, etc.) may bedescribed or claimed as “configured” to perform one or more tasks oroperations. This formulation—[entity] configured to [perform one or moretasks]—is used herein to refer to structure (i.e., something physical,such as an electronic circuit). More specifically, this formulation isused to indicate that this structure is arranged to perform the one ormore tasks during operation. A structure can be said to be “configuredto” perform some task even if the structure is not currently beingoperated. A “clock circuit configured to generate an output clocksignal” is intended to cover, for example, a circuit that performs thisfunction during operation, even if the circuit in question is notcurrently being used (e.g., power is not connected to it). Thus, anentity described or recited as “configured to” perform some task refersto something physical, such as a device, circuit, memory storing programinstructions executable to implement the task, etc. This phrase is notused herein to refer to something intangible. In general, the circuitrythat forms the structure corresponding to “configured to” may includehardware circuits. The hardware circuits may include any combination ofcombinatorial logic circuitry, clocked storage devices such as flops,registers, latches, etc., finite state machines, memory such as staticrandom access memory or embedded dynamic random access memory, customdesigned circuitry, analog circuitry, programmable logic arrays, etc.Similarly, various units/circuits/components may be described asperforming a task or tasks, for convenience in the description. Suchdescriptions should be interpreted as including the phrase “configuredto.”

The term “configured to” is not intended to mean “configurable to.” Anunprogrammed FPGA, for example, would not be considered to be“configured to” perform some specific function, although it may be“configurable to” perform that function. After appropriate programming,the FPGA may then be said to be “configured” to perform that function.

Reciting in the appended claims a unit/circuit/component or otherstructure that is configured to perform one or more tasks is expresslyintended not to invoke 35 U.S.C. § 112(f) interpretation for that claimelement. Accordingly, none of the claims in this application as filedare intended to be interpreted as having means-plus-function elements.Should Applicant wish to invoke Section 112(f) during prosecution, itwill recite claim elements using the “means for” [performing a function]construct.

In an embodiment, hardware circuits in accordance with this disclosuremay be implemented by coding the description of the circuit in ahardware description language (HDL) such as Verilog or VHDL. The HDLdescription may be synthesized against a library of cells designed for agiven integrated circuit fabrication technology, and may be modified fortiming, power, and other reasons to result in a final design databasethat may be transmitted to a foundry to generate masks and ultimatelyproduce the integrated circuit. Some hardware circuits or portionsthereof may also be custom-designed in a schematic editor and capturedinto the integrated circuit design along with synthesized circuitry. Theintegrated circuits may include transistors and may further includeother circuit elements (e.g. passive elements such as capacitors,resistors, inductors, etc.) and interconnect between the transistors andcircuit elements. Some embodiments may implement multiple integratedcircuits coupled together to implement the hardware circuits, and/ordiscrete elements may be used in some embodiments. Alternatively, theHDL design may be synthesized to a programmable logic array such as afield programmable gate array (FPGA) and may be implemented in the FPGA.

As used herein, the term “based on” or “dependent on” is used todescribe one or more factors that affect a determination. This term doesnot foreclose the possibility that additional factors may affect thedetermination. That is, a determination may be solely based on specifiedfactors or based on the specified factors as well as other, unspecifiedfactors. Consider the phrase “determine A based on B.” This phrasespecifies that B is a factor used to determine A or that affects thedetermination of A. This phrase does not foreclose that thedetermination of A may also be based on some other factor, such as C.This phrase is also intended to cover an embodiment in which A isdetermined based solely on B. As used herein, the phrase “based on” issynonymous with the phrase “based at least in part on.”

This specification includes references to various embodiments, toindicate that the present disclosure is not intended to refer to oneparticular implementation, but rather a range of embodiments that fallwithin the spirit of the present disclosure, including the appendedclaims. Particular features, structures, or characteristics may becombined in any suitable manner consistent with this disclosure.

This specification may use the words “a” or “an” to refer to an element,or “the” to refer to the element. These words are not intended to meanthat there is only one instance of the element. There may be more thanone in various embodiments. Thus, “a”, “an”, and “the” should beinterpreted to mean “one or more” unless expressly described as onlyone.

This specification may describe various components, units, circuits,etc. as being coupled. In some embodiments, the components, units,circuits, etc. may be coupled if they are electrically coupled (e.g.directly connected or indirectly connected through one or more othercircuits) and/or communicatively coupled.

DETAILED DESCRIPTION OF EMBODIMENTS

As mentioned above, a processor implementing various embodiments ofcompression assist instructions is disclosed. Generally, a compressionassist instruction may be an instruction designed to improve theperformance of the processor when performing compression and/ordecompression. Thus, a compression assist instruction may be aninstruction expected to be used only in decompression, in some cases. Inother cases, a compression assist instruction may be expected to be usedonly in compression, or in both compression and decompression.

To illustrate the compression assist instructions and their application,several implementations of the Finite State Entropy (FSE) compressionalgorithm are shown. While FSE is used as an example, and mechanism thatemploys one or more bit streams or bit stacks as part of the compressionmay benefit from the compression assist instructions described below.

FIG. 1 is a block diagram of one embodiment of decompression ofFSE-compressed data. As shown in FIG. 1, the data includes a table 10and a bit stream 12. That is, when the data was compressed unit the FSEcompression algorithm, the table 10 and the bit stream 12 weregenerated. An initial state may be used to lookup an initial entry inthe table. That is, the state (illustrated at reference numeral 16) maybe an index into the table 10. Each entry may include data similar tothat shown at reference numeral 14. Particularly, the entry may includea base, a symbol, and a number of bits (n). The symbol is part of theoutput data, and may be provided to be assembled with previously readsymbols to produce an output data stream that is the original data. Thatis, the symbol is part of the original data and may be concatenated tothe end of the data stream (or in the case of the initial state, mayinitialize the data stream). The number of bits (n) may specify a numberof bits to be consumed from the bit stream 12 to provide a delta valueto be added to the base to generate the next state. The next statereplaces the initial state and looks up a table entry, from which thenext symbol and next state may be generated. Repeating the next stategeneration, lookup, and symbol output continuously may produce a symbolstream that is the uncompressed original data. At some point, an entryin the table may indicate that the end of the data has been reached.Alternatively, the uncompressed data may be a fixed size and thus thenext state generation, look up, and symbol output may occur a fixednumber of times (assuming a fixed-size symbol).

The embodiment of FIG. 1 is a fairly serial process, and thus may berelatively slow. Various embodiments may perform a more paralleloperation. For example, in FIG. 2, 4 states may be looked up inparallel. The four states 24 may correspond to four interleaved FSEsymbol streams that share the same decoder table 26. That is, the symbolstreams may be independent of each other, but interleaved in the bitstack 20. Other embodiments may implement more or fewer parallelstates/symbol streams, as desired. Each state 24 may read a table entry22 from a table 26. Each table entry 22 may be similar to the tableentry 14 shown in FIG. 1. Each of the 4 table entries 22 read inparallel may provide a symbol, which may be concatenated with thecorresponding output symbol stream (or to initialize the correspondingoutput symbol streams, for the initial states 24). Each entry consumesits specified number of bits (n) from the bit stack 20 (where the entryat the top in FIG. 2 reads the bits at the top of the bit stack 20, thenext entry down reads the next bits from the bit stack 20, etc.). Thus,as mentioned above, the bit stack 20 may have interleaved bit fields forthe symbol streams. The result deltas are added to the bases from therespective entry 22 to generate the next states 24.

FIG. 3 illustrates another embodiment of a parallelized form of the FSEalgorithm. In the embodiment of FIG. 3, instead of storing the symbolsdirectly in a table 30, the symbols may be generated from a base valueread from a table 30 (the value base, or VBase) and a delta read fromanother bit stack 32 (the value bit stack, or VBit stack 32) may be usedto generate the symbols. That is, each symbol may correspond to a rangeof values beginning at VBase, and the particular value at a given pointin the decode process is determined by reading the delta from the VBitstack 32 and adding it to the VBase. The table entries 34 may thusinclude a VBase and a number of bits (nv) to consume from the VBit stack32 to be used as deltas (VDeltas) to add to the VBase to generate theoutput symbol from the entry. Additionally, each entry 34 may include astate base (SBase) and a number of bits (ns) to read from a state bitstack 36 (SBit stack 36) to form deltas (SDeltas) to add to the SBasefrom each entry to generate the next states 38. In an embodiment, theVBit stack 32 and the SBit stack 36 may be implemented as a single bitstack, with the VBits and the SBits interleaved in the stack. In stillother embodiments, a combination of interleaving of Vbits and Sbits in astack and implementing multiple stacks may be used. For example, a setof 16 symbol streams may be represented as 4 sets of 4 interleavedsymbol streams (e.g. 4 bit stacks).

One way to perform the decompression shown in FIG. 2 or 3 in a processorthat includes vector instructions would be to use vector operations. Forexample, if vectors of 4 vector elements are supported by a processor,the embodiments of FIGS. 2 and 3 could perform the table look up, nextstate generation, and symbol value generation using one vectorinstruction for each operation involved in the table look up, next stategeneration, and symbol value generation. However, the bit stack readoperations may be more difficult to vectorize using standard vectorinstructions.

Generally, vector operations perform a specified operation on aplurality of vector elements in one or more vector operands in paralleland independently for each vector element. For example, a vector addoperation may add vector elements in corresponding positions within thevector operands, producing sums as vector elements of a vector resultoperand. A four element vector would have vector elements VE0, VE1, VE2,and VE3, in the listed order in adjacent vector element positions withinthe vector. A vector add would add the VE0 elements of the sourceoperands to produce the VE0 element of the result operand; add the VE1elements of the source operands to produce VE1 element of the resultoperand; etc. While a four element vector is used as an example, otherembodiments may employ different numbers of vector elements per vectorand/or may support multiple numbers of vector elements per vector. Forexample, a 128 bit vector register set could support 2 64-bit vectorelements, 4 32-bit vector elements, 8 16-bit vector elements, and 168-bit vector elements. Various vector instructions may be defined to usethe vector registers as vector elements of different sizes.

Thus, vector operations/instructions perform well on vector elementsthat are the same size, and many operations may be performed in parallelto improve performance of vectorizable algorithms. The bit stack readoperations (and corresponding bit stack write operations duringcompression) may be variable size operations, however. Each bit stackread may be any number of bits, from 1 (or possibly even 0 bits) to thelargest number of bits supported by the algorithm. For example, in oneembodiment of the algorithm in FIG. 3, bit stack reads from 1 to 32 bitsmay be supported. Implementing the bit stack as fixed size elements(e.g. 32 bits in the example) would significantly reduce the compressionratio achievable for the algorithm and thus would be counterproductive.

In order to enhance the use of vector operations to perform compressionand decompression for compression algorithms similar to that shown inFIGS. 1-3, compression assist instructions have been defined to performthe bit stack read and write operations, transferring data from the bitstack to vector elements (bit stack read) and from vector elements topacked bit stack data (bit stack write).

FIGS. 4-5 illustrate the bit stack read operation and bit stack writeoperation to and from vector registers, for one embodiment. Thecompression assist instructions have been defined to cause the processor(when executing the compression assist instructions) to interpret thedata in one or more vector registers storing operands of the instructionas bit stack data rather than vector elements. Thus, a portion of thebit stack may be loaded into a vector register and processed using thecompression assist instructions defined herein. Any vector register maybe specified as such an operand; it is the coding of the vector registeras a particular operand of a compression assist instruction that causesthe processor to interpret the register data as bit stack data insteadof vector elements.

FIG. 4 illustrates a bit stack read operation. A portion of a bit stack40 including the top of the bit stack is shown in FIG. 4. The top of thebit stack may be on the left in FIG. 4, and may include deltas x3 (topof stack), x2 (next to top of stack), x1, and x0 as well as additionalvalues below those. The widths of x3, x2, x1, and x0 in FIG. 4 vary toillustrate that each value is one or more bits and may vary. A firstvector register 42 has four vector elements storing the sizes of the topfour deltas on the stack (b3 corresponding to x3, b2 corresponding tox2, etc.). The register 42 may be loaded from the fields “n” in FIG. 2for a given table read based on a set of next states, or from the filed“nv” or “ns” in FIG. 3 for a given table read. For the embodiment ofFIG. 3, two vector registers may be used, one for “nv” and one for “ns.”Generally, a vector load instruction or instructions may perform thetable read, and there may be additional vector instructions to isolatethe size values in the register 42 to perform the bit stack read.

Based on the sizes in the register 42, the bit fields x3, x2, x1, and x0may be extracted from the top of the bit stack into a result vectorregister 44, and the bit stack may be updated to remove the extractedbit fields. Thus, the updated stack 46 in FIG. 4 includes the remainingadditional values at the top of the stack. The stacks 40 and 46 mayillustrate the values in memory, such that the top of the stack moves inmemory. When the top of the stack is loaded into a register, as will bedescribed below, the bit stack read may include shifting the new top ofthe stack left in the register (e.g. so that the most significant bit,or MSB, of the register has the bit at the top of the stack).

Bit stack read operations may be part of the decompression process.Creating the bit stack may include bit stack write operations, as thecompression algorithm determines the symbols and generates the tableentries and bit stack. FIG. 5 illustrates a bit stack write operation.

The initial bit stack 48 in FIG. 5 includes the additional values at thetop of the stack, similar to the updated bit stack 46 in FIG. 4. Spaceis shown to the left of the top of the bit stack 48 in FIG. 4 toillustrate pushing more bit fields into the bit stack as part of the bitstack write. A vector register 50 may be coded with vector elementscorresponding to the size of each bit field (b3 corresponding to x3, b2corresponding to x2, etc.). Another vector register 52 may have the bitfields as vector elements (x3, x2, etc.). Vector registers 50 and 52 maybe computed according to the compression algorithm, using other vectorinstructions. The bit stack write operation concatenates the bit fieldsx3, x2, x1, and x0, making them adjacent in the bit stack, and writesthe bit fields to the top of the bit stack, producing the updated bitstack 54 shown in FIG. 5.

To implement the bit stack read operation illustrated in FIG. 4, aprocessor as described herein may include a pair of compression assistinstructions. These instructions are referred to herein as “top” and“pop.” The top instruction, when executed, may cause the processor toextract a plurality of bit fields from a top of the bit stack (which maybe stored in a vector register, as discussed below) into vector elementsof a result vector register. The pop instruction, when executed, maycause the processor to remove the bit fields from the top of the stack,moving the top of the stack down to the next set of bit fields that havenot been extracted using a top instruction.

FIG. 6 is a block diagram of the source operands and result operand ofthe top instruction, for one embodiment. At the top of FIG. 6, amnemonic for the top instruction is shown with a result vector register(RV), a source stack register (SSR), and a source size vector register(SSV). The source stack register contents are illustrated at referencenumeral 60, the source size vector register contents are illustrated atreference numeral 62, and the result vector register contents afterexecution of the top instruction are illustrated at reference numeral64.

As mentioned previously, the stack register may be a vector register,but the processor may interpret the contents differently by virtue ofthe register being specified as a stack operand of one of thecompression assist instructions. When the vector register is storing bitstack data, the register may include a bit stack field 66 and a bitcount field 68. The bit stack field may be a plurality of bits, with theMSB of the plurality of bits in the MSB of the register in thisembodiment. The MSB of the plurality of bits may be the top bit of thebit stack. The bit count field 68 may be the number of bits currently inthe stack register (e.g. the number of the plurality of bits in the bitstack field 66). In one embodiment, the vector register may be 128 bitsand the bit count field may be 8 bits. Thus, the bit stack field 66 maybe up to 120 bits in this embodiment. Other embodiments may implementdifferent size vector registers and support larger or smaller bit stackfields and bit count fields.

Within the bit stack field 66, the bit fields x3, x2, x1, and x0 areidentified in FIG. 6. The bit fields are defined by the sizes in thesource size vector register 62. More particularly, the source sizevector register 62 may be a vector of sizes. That is, the sizes may becounts of the number of bits in the corresponding bit fields. The sizesmay be integers, for example. In the illustrated embodiment, there arefour vector elements in the source size vector 62: vector element 3(VE3), VE2, VE1, and VE0. Each vector element specifies a size of acorresponding bit field. Thus, the bit field x3 may be the mostsignificant b3 bits of the bit stack field 66. The bit field x2 may beadjacent to the bit field x3 (e.g. the MSB of bit field x2 may beadjacent to the least significant bit, or LSB, of the bit field x3) andmay be b2 bits in size. The bit field x1 may be adjacent to the bitfield x2 and may be b1 bits in size, and the bit field x0 may beadjacent to the bit field x1 and may be b0 bits in size. The remainingbits in the bit stack field 66 are labeled “p” in FIG. 6. The MSB of pmay be the MSB of the next bit field in the bit stack, which may bedefined by the next table read from the table 26 or 30. While the sizefields in the register 62 are shown as occupying a portion on the vectorelements in FIG. 6, the fields may occupy up to the entire vectorelements. Furthermore, the extracted bit fields in the result vectorregister 64 may be up to the full size of the vector elements, althoughthe size of each individual field is controlled by the correspondingvector element from the size vector.

Based on the size fields in the source size vector register 62, theprocessor executing the top instruction may be configured to extract thebit fields into correspond vector elements of the result vector register64. Thus, x3 is element VE3 of the result vector register 64, extractedbased on size b3 in VE3 of the source size vector register 62; x2 iselement VE2 of the result vector register 64, extracted based on size b2in VE2 of the source size vector register 62 and also affected by b3since x3 is extracted from the MSBs of the bit stack field 66 inparallel; x1 is element VE1 of the result vector register 64, extractedbased on size b1 in VE1 of the source size vector register 62 and alsoaffected by b3 and b2; and x0 is element VE0 of the result vectorregister 64, extracted based on size b0 in VE0 of the source size vectorregister 62 and also affected by b3, b2, and b1.

FIG. 7 is a block diagram of the source operands and result operand ofthe pop instruction, for one embodiment. At the top of FIG. 7, amnemonic for the pop instruction is shown with a result stack register(RSR), the source stack register (SSR), and the source size vectorregister (SSV). The source stack register contents are illustrated atreference numeral 60, the source size vector register contents areillustrated at reference numeral 62, and the result stack registercontents after execution of the pop instruction are illustrated atreference numeral 70. The pop instruction may be intended to be pairedwith the top instruction, to adjust the contents of the bit stack toreflect extraction and consumption of the bit fields x3, x2, x1, and x0.Thus, the same source registers 60 and 62 are shown. However, the popinstruction may generally be coded with any source registers.

As mentioned, a processor executing the pop instruction removes the bitscorresponding to the bit fields consumed by the top instruction. Thus,the pop instruction may use the sum of the size vector elements b3, b2,b1, and b0 from the source size vector register 62 to identify thenumber of bits to remove, beginning with the MSB of the register. Theremaining bits (p) may be shifted so that the MSB of p is the MSB of theresult stack register 70. Additionally, the bit count field (n′) may becomputed as illustrated at reference numeral 72, by subtracting the sumof the size vector elements from the bit count field n in the sourcestack register 60.

It is noted that the result stack register 70 may be coded to be thesame register as the source stack register 60 in the pop instruction,thus updating the source stack register 60 for the next stack readoperation using the top instruction to extract the next set of bitfields. As the bit stack field in the stack register becomes depleted,it may be refilled from the remaining bit stack in the memory via a loadinstruction. A vector load instruction may be used, since the vectorload instruction may merely load the data into the register. It is theuse of the register as a stack register operand that causes theprocessor to interpret the contents as a bit stack instead of vectorelements.

The top and pop instructions may be compression assist instructions thatmay be useful for decompression. In some embodiments, one or morecompression assist instructions may be defined for compression as well.Particularly, compression assist instructions may be defined for the bitstack write operation illustrated in FIG. 5. In one embodiment, twocompression assist instructions are defined: “create” and “concat.”

FIG. 8 is a block diagram of the source operands and result operand ofthe create instruction, for one embodiment. At the top of FIG. 8, amnemonic for the create instruction is shown with a result stackregister (RSR), a source vector register (SV), and a source size vectorregister (SSV). Various vector instructions may be executed to generatea vector of bit fields and corresponding sizes, which may be in a sourcevector register 80 and a source size vector register 82 when the bitstack write operation is ready to be performed. The registers 80 and 82are shown in FIG. 8, and include vector elements storing the bit fields(register 80) and corresponding vector elements storing the sizes(register 82). Thus, VE3 of the register 80 is a bit field x3 of size b3(VE3 of the register 82), VE2 of the register 80 is a bit field x2 ofsize b2 (VE2 field of the register 82), etc. When a processor executesthe create instruction, the processor may pack the bit fields from thesource vector register 80 into the MSBs of the result stack register 84,forming a plurality of bits in the MSBs of the result stack register 84that include the bit fields x3, x2, x1, and x0 in adjacent bit positionswithin the plurality of bits (e.g. the LSB of x3 is adjacent to the MSBof x2, the LSB of x2 is adjacent to the MSB of x1, etc.). The bit countfield “n” may be computed as a sum of the size vector elements from theregister 82, as illustrated at reference numeral 86.

The create instruction creates a plurality of bits from a vector of bitfields. The concat instruction may be used to insert the result of thecreate instruction into a previous version of the bit stack (e.g.pushing the plurality of bits onto the bit stack). The concatinstruction may also be used in bit stack read operations, to refill adepleted bit stack register from memory. For example, a next portion ofthe bit stack may be loaded from memory into a vector register, and maybe concatenated into the bit stack register being used for bit stackreads.

FIG. 9 is a block diagram of the source operands and result operand ofthe concat instruction, for one embodiment. At the top of FIG. 9, amnemonic for the concat instruction is shown with a result stackregister (RSR), a source stack registerl (SSR1), and a source stackregister 2 (SSR2). The source stack registers 1 and 2 are illustrated atreference numerals 88 and 90, respectively. Each source stack registermay include a plurality of bits (p1 in register 88, p2 in register 90)and a bit count field indicate a number of the plurality of bits (n1 inregister 88, n2 in register 90). The processor executing the concatinstruction may concatenate the p2 bits to the p1 bits, creating alarger plurality of bits as shown in the result stack register 92. Thebit count filed in the result stack register may be computed as shown atreference numeral 94, as the sum of the bit count fields n1 and n2.

While the embodiments of FIGS. 6-9 illustrate vectors with 4 vectorelement, other embodiments may support vectors with more or fewer vectorelements (e.g. 2, 8, 16, etc.). Additionally, as mentioned previously,some embodiments may support multiple versions of the vectorinstructions, including the compression assist instructions, to usevectors with different numbers of vector elements (or an operand such asan immediate field may select how many vector elements are in the vectorfor that instruction).

FIG. 10 is a block diagram of one embodiment of a computer system 100.The computer system 100 includes a processor 102, a level two (L2) cache106, a memory 108, and a mass-storage device 110. As shown, theprocessor 102 includes a level one (L1) cache 104 and an execution core120 coupled to the L1 cache 104 and a register file 112. The executioncore 120 may include one or more execution units such as an integerexecution unit 114, a floating point (FP) execution unit 116, and avector execution unit 118 as shown. The execution units 114, 116, and118 may be coupled to the register file 112, and/or there may bemultiple register files 112 for different operand types, in variousembodiments. It is noted that although specific components are shown anddescribed in computer system 100, in alternative embodiments differentcomponents and numbers of components may be present in computer system100. For example, computer system 100 may not include some of the memoryhierarchy (e.g., L2 cache 104, memory 108 and/or mass-storage device110). Multiple processors similar to the processor 102 may be included.Multiple execution units of a given type (e.g. integer, floating point,vector, load/store, etc.) may be included and the number of executionunits of a given type may differ from the number of execution units ofanother type. Additionally, although the L2 cache 106 is shown externalto the processor 102, it is contemplated that in other embodiments, theL2 cache 106 may be internal to the processor 102. It is further notedthat in such embodiments, a level three (L3) cache (not shown) may beused. In addition, the computer system 100 may include graphicsprocessors, video cards, video-capture devices, user-interface devices,network cards, optical drives, and/or other peripheral devices that arecoupled to processor 102 using a bus, a network, or another suitablecommunication channel (all not shown for simplicity).

In various embodiments, the processor 102 may be representative of ageneral-purpose processor that performs computational operations. Forexample, the processor 102 may be a central processing unit (CPU) suchas a microprocessor, a microcontroller, an application-specificintegrated circuit (ASIC), or a field-programmable gate array (FPGA).The processor 102 may be a standalone component, or may be integratedonto an integrated circuit with other components (e.g. other processors,or other components in a system on a chip (SOC), etc.). The processor102 may be a component in a multichip module (MCM) with othercomponents.

More particularly, as illustrated in FIG. 1, the processor 102 mayinclude the execution core 120. The execution core 120 may be configuredto execute instructions defined in an instruction set architectureimplemented by the processor 102. The execution core 120 may have anymicroarchitectural features and implementation features, as desired. Forexample, the execution core 120 may include superscalar or scalarimplementations. The execution core 120 may include in-order orout-of-order implementations, and speculative or non-speculativeimplementations. The execution core 120 may include any combination ofthe above features. The implementations may include microcode, in someembodiments. The execution core 120 may include a variety of executionunits, each execution unit configured to execute operations of varioustypes (e.g. the integer execution unit 114, the floating point executionunit 116, the vector execution unit 118, a load/store execution unit(not shown) etc.). The execution core 120 may include different numberspipeline stages and various other performance-enhancing features such asbranch prediction. The execution core 120 may include one or more ofinstruction decode units, schedulers or reservations stations, reorderbuffers, memory management units, I/O interfaces, etc.

The register file 112 may include a set of registers that may be used tostore operands for various instructions. The register file 112 mayinclude registers of various data types, based on the type of operandthe execution core 120 is configured to store in the registers (e.g.integer, floating point, vector, etc.). The register file 112 mayinclude architected registers (i.e. those registers that are specifiedin the instruction set architecture implemented by the processor 102).Alternatively or in addition, the register file 112 may include physicalregisters (e.g. if register renaming is implemented in the executioncore 120).

The L1 cache 104 may be illustrative of any caching structure. Forexample, the L1 cache 104 may be implemented as a Harvard architecture(separate instruction cache for instruction fetching and data cache fordata read/write by execution units for memory-referencing ops), as ashared instruction and data cache, etc. In some embodiments, load/storeexecution units may be provided to execute the memory-referencing ops.

An instruction may be an executable entity defined in an instruction setarchitecture implemented by the processor 102. There are a variety ofinstruction set architectures in existence (e.g. the x86 architectureoriginal developed by Intel, ARM from ARM Holdings, Power and PowerPCfrom IBM/Motorola, etc.). Each instruction is defined in the instructionset architecture, including its coding in memory, its operation, and itseffect on registers, memory locations, and/or other processor state. Agiven implementation of the instruction set architecture may executeeach instruction directly, although its form may be altered throughdecoding and other manipulation in the processor hardware. Anotherimplementation may decode at least some instructions into multipleinstruction operations for execution by the execution units in theprocessor 102. Some instructions may be microcoded, in some embodiments.Accordingly, the term “instruction operation” may be used herein torefer to an operation that an execution unit in the processor102/execution core 120 is configured to execute as a single entity.Instructions may have a one to one correspondence with instructionoperations, and in some cases an instruction operation may be aninstruction (possibly modified in form internal to the processor102/execution core 120). Instructions may also have a one to more thanone (one to many) correspondence with instruction operations. Aninstruction operation may be more briefly referred to herein as an “op.”

The mass-storage device 110, memory 108, L2 cache 10, and L1 cache 104are storage devices that collectively form a memory hierarchy thatstores data and instructions for processor 102. More particularly, themass-storage device 110 may be a high-capacity, non-volatile memory,such as a disk drive or a large flash memory unit with a long accesstime, while L1 cache 104, L2 cache 106, and memory 108 may be smaller,with shorter access times. These faster semiconductor memories storecopies of frequently used data. Memory 108 may be representative of amemory device in the dynamic random access memory (DRAM) family ofmemory devices. The size of memory 108 is typically larger than L1 cache104 and L2 cache 106, whereas L1 cache 104 and L2 cache 106 aretypically implemented using smaller devices in the static random accessmemories (SRAM) family of devices. In some embodiments, L2 cache 106,memory 108, and mass-storage device 110 are shared between one or moreprocessors in computer system 100.

In some embodiments, the devices in the memory hierarchy (i.e., L1 cache104, etc.) can access (i.e., read and/or write) multiple cache lines percycle. These embodiments may enable more effective processing of memoryaccesses that occur based on a vector of pointers or array indices tonon-contiguous memory addresses.

It is noted the data structures and program instructions (i.e., code)described below may be stored on a non-transitory computer-readablestorage device, which may be any device or storage medium that can storecode and/or data for use by a computer system (e.g., computer system100). Generally speaking, a non-transitory computer-readable storagedevice includes, but is not limited to, volatile memory, non-volatilememory, magnetic and optical storage devices such as disk drives,magnetic tape, compact discs (CDs), digital versatile discs or digitalvideo discs (DVDs), or other media capable of storing computer-readablemedia now known or later developed. As such, mass-storage device 110,memory 108, L2 cache 10, and L1 cache 104 are all examples ofnon-transitory computer readable storage media.

As mentioned above, the execution core 120 may be configured to executevector instructions (e.g. in the vector execution unit 118). The vectorinstructions may be defined as single instruction-multiple-data (SIMD)instructions in the classical sense, in that they may define the sameoperation to be performed on multiple data elements in parallel. Thedata elements operated upon by an instance of an instruction may bereferred to as a vector. The data elements forming the vector may bereferred to as vector elements. Vector elements themselves may have anydata type (e.g. integer, floating point, etc.) and more than one datatype may be supported for vector elements.

In one embodiment, the register file 112 may include vector registersthat can hold operand vectors and result vectors. In some embodiments,there may be 32 vector registers in the vector register file. However,in alternative embodiments, there may be different numbers of vectorregisters and/or different numbers of bits per register. Furthermore,embodiments which implement register renaming may include any number ofphysical registers that may be allocated to architected vectorregisters. Architected registers may be registers that are specifiableas operands in vector instructions.

More particularly, the vector execution unit 118 may be configured toexecute the compression assist instructions described herein (or opsdecoded from the compression assist instructions), in addition tovarious vector operations such as arithmetic operations, logic,operations, shifts, etc.

FIG. 11 is a block diagram of one embodiment of at least a portion ofthe vector execution unit 118, including circuitry configured to executevarious compression assist instructions. The circuitry shown in FIG. 11may include circuitry that is shared with other types of vectoroperations and/or circuitry that is dedicated to the compression assistinstructions, or any combination thereof. The vector execution unit 118is coupled to inputs for the op to be executed, as well as the sourceoperands V1 and V2. The result operation may be specified as part of theop and may be forwarded with the result to the register file 112.

A control circuit 130 may receive the op and may control the othercircuitry in the vector execution unit 118 accordingly. Thus, thecontrol circuit 130 may be coupled to the other circuitry shown in FIG.11, although the connections are not expressly illustrated in FIG. 11 toavoid complicating the drawing. An adder circuit 132 may be provided,which may be coupled to the second source operand V2. The adder circuit132 may be configured to add various elements of the vector V2. Forexample, when the source operand V2 is a size vector, sums of the sizesmay be used during execution of the op. The sum of all the vectorelements may be used in the update of the bit count field (n), when theresult operand is a stack register. Additionally, partial sums of thevector elements may be used as well.

For example, the top instruction may be implemented by right shiftingthe MSBs of the stack based on the partial sums and the size of thevector elements. In the four vector element case, if vector elements are32 bits in size, a right shift of the 32 MSBs by 32-b3 may align x3 tothe VE3 element in the result vector (e.g. a right shift by the vectorelement size (Vs)−b3). Similarly, a right shift of the 64 MSBs by64−(b3+b2) may align x2 to the VE2 element in the result vector (e.g.2Vs−(b3+b2)); a right shift of the 96 MSBs by 96−(b3+b2+b1) may align x2to the VE1 element in the result vector (e.g. 3Vs−(b3+b2+b1)); and aright shift of the 128 MSBs by 128−(b3+b2+b1+b0) may align x0 to the VE0element in the result vector (e.g. 4Vs−(b3+b2+b1+b0)). Other elementsizes and numbers of elements may be implemented similarly. Thus, theshift circuits 134A-134N may be coupled to V1 operand and to respectivesums from the adder circuit 132 to execute the top instruction.Corresponding mask circuits 136A-136N may be coupled to the outputs ofthe shift circuits 134A-134N to mask the bits that are not part of thevector elements (e.g. since x3 and x2 are adjacent in the source stackregisters, some of the bits of x3 may be in MSBs of the VE2 elementafter the shift and may be masked). While individual shift circuits134A-134N and mask circuits 136A-136N are shown in FIG. 11, otherembodiments may implement a shared shift circuit with control inputsfrom the control circuit 130 to control the shifts for each vectorelement position, based on the size of a given vector. That is, theshared shift circuit may be defined to perform 2 64-bit shifts, 4 32-bitshifts, 8 16-bit shifts, or 16 8-bit shifts based on the size of thevector elements of a given operand. The control inputs may select thecorrect shifts to be performed based on the size selected for a givenop. The shift circuits 134A-134N and the mask circuits 136A-136N maythus be one implementation of extraction of bit fields from theplurality of bits in the source stack register to the vector elements ofthe result vector register.

A shift circuit 140 may be provided for the pop instruction/op. Theshift circuit 140 may left shift the stack register operand by the sumof the sizes in the size vector register (provided by the adder circuit132). Thus, the shift circuit 140 may be coupled to the adder 132 andthe V1 source operand. Alternatively, the shifter circuits 134A-134N maybe configured to perform the shift for the pop op as well and the shiftcircuit 136 may not be needed. A compute n circuit 138 may be providedto compute the updated n for the pop instruction/op as well as thecreate and concat instructions/ops. The compute n circuit 138 may becoupled to the adder circuit 132 and may be receive the sum of the sizesof the vector elements (e.g. b3+b2+b1+b0) to compute n for the pop andcreate instructions/ops.

The create instruction/op may also be performed using the shift circuits134A-134N, in an embodiment, to left shift the source vector elements tothe MSBs of the result. For example, the x3 element may be left shiftedby the vector element size (Vs) less the size of the x3 element (b3)(e.g. Vs−b3). The x2 element may be left shifted by twice the vectorelement size less the size of the x3 and x2 elements (e.g. 2Vs−(b3+b2)).Similarly, the x1 element may be left shifted by 3Vs−(b3+b2+b1) and thex0 element may be left shifted by 4Vs−(b3+b2+b1+b0). The resultingshifted values may be masked and logically ORed together to produce theoutput plurality of bits for the result stack register. Accordingly, thesums generated by the adder circuit 132 may be used by the shiftcircuits 134A-134N. The adder circuit 132 may be configured to generatethe full shift amounts including the vector element sizes, or the shiftcircuits 134A-134N may account for the vector element sizes, explicitlyor implicitly.

The concat instruction/op may be performed using the shift circuit 136(to right shift the p2 bits by n1) and the compute n circuit 138 to addn1 and n2 to produce the output n. The shifted p2 may be logically ORedwith the p1 bits to produce the output bits for the result stackregister, for example.

The output select circuit 142 shown in FIG. 11 may be coupled to themask circuits 136A-136N, the compute n circuit 138, and the shiftcircuit 140 and may be configured to select among the outputs based onthe op being performed to provide an output to the register file 112.For example, the outputs of the mask circuits 136A-136N, concatenatedtogether, may be selected for the top instruction whereas the output ofthe shift circuit 140 and the compute n circuit 138 may be selected forthe pop, create, and concat instructions.

It is noted that the circuitry of FIG. 11 is merely one example of animplementation of a portion of the vector execution unit 118. Any otherdesired circuitry may be used. For example, the shift circuits may berotate circuits. Any equivalents, including Boolean equivalents, of thecircuitry shown may be used.

FIGS. 12-15 are flowcharts illustrating the operation of one embodimentof the processor 102/execution core 120/vector execution unit 118 toexecute the various compression assist instructions described herein.While the blocks are shown in a particular order for ease ofunderstanding, other orders may be used. Blocks may be performed inparallel in combinatorial logic circuitry in the processor 102/executioncore 120/vector execution unit 118. Blocks, combinations of blocks,and/or the flowcharts as a whole may be pipelined over multiple clockcycles.

FIG. 12 is a flowchart illustrating operation to execute the topinstruction, for one embodiment. The processor 102/execution core120/vector execution unit 118 may extract the bit fields from the MSBsof the source stack register based on the source size vector (block150). For example, b3 of the MSBs may be extracted as x3, the nextconsecutive (adjacent) b2 MSBs may be extracted as x2, etc. Theprocessor 102/execution core 120/vector execution unit 118 may align thebit fields to the vector elements of the result vector register (block152). The extraction and alignment may be performed via shifting, asdescribed above. Other embodiments may extract the bit fields in otherways. The processor 102/execution core 120/vector execution unit 118 maywrite the resulting vector to the result vector register (the vectorregister identified by the result operand) (block 154).

FIG. 13 is a flowchart illustrating operation to execution the popinstruction, for one embodiment. The processor 102/execution core120/vector execution unit 118 may determine a remaining amount of thestack, based on the source size vector (block 156). For example, theprocessor 102/execution core 120/vector execution unit 118 may add thevector elements of the source size vector and determine that theremaining stack is the stack after a number of MSBs equal to the sum ofthe vector elements of the source size vector have been removed. Theprocessor 102/execution core 120/vector execution unit 118 may shift thebit stack portion of the source stack operand to put the remaining stackin the MSBs of the result stack register (block 158). For example, theprocessor 102/execution core 120/vector execution unit 118 may leftshift the source stack by the sum of the vector elements of the sourcesize vector. The processor 102/execution core 120/vector execution unit118 may compute n′ as n from the source stack register minus the sum ofthe vector elements of the size vector (block 160) and may write theshifted stack and n′ to the result stack register (block 162).

FIG. 14 is a flowchart illustrating operation to execute the createinstruction, for one embodiment. The processor 102/execution core120/vector execution unit 118 may extract the bit fields from the sourcevector elements based on the source size vector elements (block 170).The processor 102/execution core 120/vector execution unit 118 may alignthe bit fields to the MSBs of the result register (block 172). Theextraction and alignment may be performed by shifting, as previouslydiscussed. Other embodiments may perform the extraction and alignment inother ways. Once the bit fields are aligned, they may be adjacent in theresult register (e.g. the LSB of x3 may be adjacent to the MSB of x2,the LSB of x2 may be adjacent to the MSB of x1, etc.). The processor102/execution core 120/vector execution unit 118 may compute n as thesum of the size vector elements (block 174) and may write the resultstack (MSBs) and n (LSBs) to the result stack register (block 176).

FIG. 15 is a flowchart illustrating operation to execute the concatinstruction, for one embodiment. The processor 102/execution core120/vector execution unit 118 may shift the stack portion of the stacksource operand 2 left by n1 (the number of bits in the stack portion ofthe stat source operand 1) (block 178). The processor 102/execution core120/vector execution unit 118 may merge the stack portion of the sourcestack 1 with the shifted source stack 2 field (block 180). The processor102/execution core 120/vector execution unit 118 may compute n equal tothe sum of n1 and n2 from the source stack register 1 and the sourcestack register 2, respectively (block 182). The processor 102/executioncore 120/vector execution unit 118 may write the merged stack and n tothe result stack register (block 184).

Numerous variations and modifications will become apparent to thoseskilled in the art once the above disclosure is fully appreciated. It isintended that the following claims be interpreted to embrace all suchvariations and modifications.

What is claimed is:
 1. A processor comprising: a register filecomprising a plurality of vector registers; and an execution corecoupled to the register file, wherein the execution core is configuredto execute a first instruction specifying a first vector operand, asecond operand, and a result vector operand, wherein the first vectoroperand is in a first vector register of the plurality of vectorregisters, the second operand is in a second register, and the resultvector operand is to be written to a third vector register of theplurality of vector registers, wherein the execution core is configuredto extract a plurality of variable-sized bit fields from the secondoperand responsive to a plurality of vector elements in the first vectoroperand and to write the plurality of extracted variable-sized bitfields as corresponding vector elements in the result vector operandresponsive to executing the first instruction.
 2. The processor asrecited in claim 1 wherein the second register is one of the pluralityof vector registers, and wherein the execution core is configured tointerpret a portion of a value in the second register as a plurality ofconsecutive bits instead of the plurality of vector elements in responseto executing the first instruction.
 3. The processor as recited in claim2 wherein a second portion of the value is a bit count indicating anumber of the plurality of consecutive bits.
 4. The processor as recitedin claim 3 wherein the execution core is configured to execute a secondinstruction specifying the first vector operand, the second operand, anda second result operand, wherein the second result operand is to bewritten to a fourth register, and wherein the execution core isconfigured to remove a number of bits equal to a sum of the numbers ofbits specified by the vector elements of the first vector operand fromthe portion of the second operand and write a remainder of the portionof the second operand as the second result operand in the fourthregister responsive to executing the second instruction.
 5. Theprocessor as recited in claim 4 wherein the removed bits are the mostsignificant bits of the second operand, and wherein the execution coreis configured to write a remainder of the portion of the second operandto the most significant bits of the fourth register responsive toexecuting the second instruction.
 6. The processor as recited in claim 5wherein the execution core is configured to subtract the sum of thenumber of bits specified by the vector elements of the first vectoroperand from the bit count to generate a second bit count and to writethe second bit count to a third portion of the fourth registerresponsive to executing the second instruction.
 7. The processor asrecited in claim 1 wherein a first bit field of the plurality ofvariable-sized bit fields comprises a plurality of most significant bitsof the second operand, wherein a number of the plurality of mostsignificant bits is specified by a first vector element of the pluralityof vector elements in the first vector operand.
 8. The processor asrecited in claim 7 wherein a second bit field of the plurality ofvariable-sized bit fields is adjacent to the first bit field in thesecond operand, and wherein a number of bits in the second bit field isspecified by a second vector element of the plurality of vector elementsin the first vector operand, wherein the second vector element isadjacent to the first vector element in the first vector operand.
 9. Theprocessor as recited in claim 1 wherein the execution core is configuredto execute a third instruction specifying a second vector operand in asecond vector register of the plurality of vector registers, a thirdvector operand in a fourth vector register of the plurality of vectorregisters, and a third result operand, and wherein the execute core isconfigured to extract a plurality of bit fields from respective vectorelements of the second vector operand responsive to values in respectivevector elements of the third vector operand and to write the pluralityof bit fields to the third result operand responsive to executing thethird instruction.
 10. The processor as recited in claim 9 wherein theexecution core is configured to write the plurality of bit fields toadjacent bits in a first portion of the third result operand responsiveto executing the third instruction.
 11. The processor as recited inclaim 10 wherein the execution core is configured to sum the values ofthe respective vector elements of the third vector operand and to writethe sum to a second portion of the third result operand responsive toexecuting the third instruction.
 12. The processor as recited in claim 1wherein the execution core is configured to execute a fourth instructionhaving a fifth operand in a fifth register, a sixth operand in a sixthregister, and a fourth result operand, and wherein the fifth operandincludes a first portion having a first plurality of bits and a secondportion having a second bit count indicating a number of the firstplurality of bits, and wherein the sixth operand includes a firstportion having a second plurality of bits and a second portion having athird bit count indicating a number of the second plurality of bits, andwherein the execution core is configured to concatenate the firstplurality of bits and the second plurality of bits in a first portion ofthe fourth result operand responsive to executing the fourthinstruction.
 13. The processor as recited in claim 12 wherein theexecution core is configured to sum the second bit count and the thirdbit count and to write the sum to a second portion of the fourth resultoperand responsive to executing the fourth instruction.
 14. Theprocessor as recited in claim 12 wherein the fifth register, the sixthregister, and a fourth result register storing the fourth result operandare included in the plurality of vector registers and the execution coreis configured to interpret values in the fifth register, the sixthregister, and the fourth result register as the first portions andsecond portions instead of vector elements responsive to executing thefourth instruction.
 15. A processor comprising: a register filecomprising a plurality of vector registers; and an execution corecoupled to the register file, wherein the execution core is configuredto execute a first instruction specifying a first vector operand, asecond operand, and a result operand, wherein the first vector operandis in a first vector register of the plurality of vector registers, thesecond operand is in a second register, and the result operand is in athird register, wherein the execution core is configured to remove anumber of bits equal to a sum of numbers of bits specified by vectorelements of the first vector operand from a portion of the secondoperand and write a remainder of the portion of the second operand as acorresponding portion of the result operand in the third registerresponsive to executing the first instruction.
 16. The processor asrecited in claim 15 wherein the removed bits are the most significantbits of the second operand, and wherein the execution core is configuredto write a remainder of the portion of the second operand to the mostsignificant bits of the third register responsive to executing the firstinstruction.
 17. The processor as recited in claim 16 wherein theexecution core is configured to subtract the sum of the number of bitsspecified by the vector elements of the first vector operand from afirst bit count in a second portion of the second register to generate asecond bit count and to write the second bit could to the second portionof the result operand responsive to executing the first instruction. 18.The processor as recited in claim 17 wherein the first bit count is anumber of bits in the portion of the second register, and wherein thesecond bit count is a number of bits in the corresponding portion of theresult operand.
 19. A processor comprising: a register file comprising aplurality of vector registers; and an execution core coupled to theregister file, wherein the execution core is configured to execute afirst instruction specifying a first vector operand in a first vectorregister of the plurality of vector registers, a second vector operandin a second vector register of the plurality of vector registers, and aresult operand, and wherein the execute core is configured to extract aplurality of variable-sized bit fields from respective vector elementsof the first vector operand responsive to values in respective vectorelements of the second vector operand and to write the variable-sizedbit fields to the result operand responsive to executing the firstinstruction.
 20. The processor as recited in claim 19 wherein theexecution core is configured to write the plurality of variable-sizedbit fields to adjacent bits in a first portion of the result operandresponsive to executing the first instruction, and wherein the executioncore is configured to sum the values of the respective vector elementsof the second vector operand and to write the sum to a second portion ofthe result operand responsive to executing the first instruction.